<template>
	<view class="container">
		<video id="video1" class="cont" :controls="isControls" :style="{height:height}" :src="url"></video>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				height: "500px",
				isControls: false,
				url: "http://192.168.0.193:8383/v.mp4"
			}
		},
		onLoad(options) {
			this.height =this.$store.state.screenHeight+'px';
			this.playVideo();
		},
		
		methods: {
			playVideo() {
				this.isControls = true; // 显示控制器
				const videoContext = uni.createVideoContext('video1', this);
				videoContext.play(); // 播放视频
			},
		}
	}
</script>

<style lang="scss">
	.container {
		width: 100%;
		height: 100%;
		position: absolute;
	}

	.cont {
		width: 100%;
		transform: translate(-50%, -50%);
		position: absolute;
		display: block;
		left: 50%;
		top: 50%;
	}
</style>